<template>
	<div class="cate-tab2">
		<ul>
			<li>
				<article>
				<img src="../../../../public/images/tab2-4.webp" >
				<h3>长隆野生动物世界——《爸爸去哪儿》拍摄地
				<i>￥286</i>
				</h3>
				</article>
			</li>
		</ul>
		<div class="box1 swiper">
			<ol class="swiper-wrapper">
				<template  v-for="(item,index) in tabs2List">
					<li class="swiper-slide"  :key="index" v-if="index>0">
					<article>
						<img :src="item.imgURL" >
						<h5>{{item.city}}</h5>
					</article>
					<aside>
						<h3>{{item.city}}</h3>
						<h4>{{item.title}}</h4>
						<p>
							￥<strong>{{item.price}}</strong>
						</p>
					</aside>
					</li>
				</template>
			</ol>
		</div>
		<div class="xbox">
			<p>加载更多<i class="iconfont">&#xe619;</i>
			</p>
			
		</div>	
	</div>
</template>

<script>
	// 引入vue周期函数
	import{onMounted} from 'vue';
	// 2.引入Swiper的动态组件
	import Swiper,{
		FreeMode,
		EffectCoverflow
		
	}from 'swiper';
	// 3.swiper组件应用配置
	Swiper.use([FreeMode , EffectCoverflow])
	
	export default{
		name:'CategoryTab2',
		// props:['propscategoryTab2'],
		data(){
			return{
				tabs2List : [
					// {id:1,imgURL:'images/tab2-4.webp',title:'长隆野生动物世界',msg:'《爸爸去哪儿》拍摄地',city:'广州出发',price:286},
					// {id:2,imgURL:'images/tab2-1.jpg',title:'长隆野生动物世界',msg:'《爸爸去哪儿》拍摄地',city:'广州出发',price:286},
					// {id:3,imgURL:'images/tab2-2.jpg',title:'长隆野生动物世界',msg:'《爸爸去哪儿》拍摄地',city:'广州出发',price:286},
					// {id:4,imgURL:'images/tab2-3.jpg',title:'长隆野生动物世界',msg:'《爸爸去哪儿》拍摄地',city:'广州出发',price:286},
				],
				
			}
		},
		created() {
			//备份[避免堵塞]
			let that = this;
			//向dataHome.json文件发起异步请求
			this.axios.get('/api/dataHome.json').then( (res)=> {
				
				let data = res.data.Homemsg[0];
				that.tabs2List=data.tabs2List
			}).catch( (error)=> {
				console.log(error);
			});
		},
		updated(){ 
			new Swiper( '.box1' , {
				freeMode:{
					momentum:true
				},
			 slidesPerView : 3,	
			} )
		} 
		
	}
</script>

<style scoped>
	a{
		text-decoration: none;
		color: black;
	}
	.cate-tab2{
		height: 9.5rem;
	}
	.cate-tab2 ul{
		width: 100%;
		height: 4.1rem;
	}
	.cate-tab2 ul li{
		width: 100%;
		height: 100%;
	}
	.cate-tab2 ul li article{
		width: 99%;
		height: 100%;
		position: relative;
	}
	.cate-tab2 ul li i{
		color: #ff7100;
		font-size: 0.35rem;
		font-weight: bold;
		text-align: right;
		float: right;
		padding-right: 0.25rem;
	}
	.cate-tab2 ul li article h3{
		position: absolute;
		top: 0;
		margin-top: 3rem;
		color: white;
		height: 1rem;
		width: 99.5%;
		font-size: 0.3rem;
		padding-left: 0.05rem;
		line-height: 1rem;
		background-color: rgba(0,0,0,0.6);
	}
	.cate-tab2 ul li:first-child img{
		width: 100%;
		height: 4rem;
		border-radius: 0.3rem 0.3rem 0 0;
		background-size: 100%;
	}
	.cate-tab2  ol {
		width: 100%;
		height: 3.8rem;
		display: flex;
		align-items: center;
		justify-content: space-between;
	}
	.cate-tab2  ol li  {
		width: 32% ;
		height: 3.8rem;
		margin-right: 0.05rem;
	}
	.cate-tab2   ol li article{
		position: relative;
		width: 92%;
	}
	.cate-tab2   ol li img{
		margin-top: 0.2rem;
		width: 100%;
		height: 2.1rem;

		border-radius: 0.2rem;
	}
	.cate-tab2   ol li h5{
		position: absolute;
		left: 0;
		top: 0;
		color: white;
		background-color: rgba(0,0,0,0.65);
		margin-top: 0.18rem;
		padding: 0.12rem 0.25rem;
		border-radius: 0.2rem 0 0.2rem 0;
	}
	.cate-tab2   ol li aside h3{
		font-size: 0.35rem;
		line-height: 0.5rem;
		text-align: left;
		margin-left: 0.15rem;
	
	}
	.cate-tab2  ol li aside h4{
		width: 100%;
		height: 0.35rem;
		color: #989898;
		text-align: left;
		margin-left: 0.15rem;
		/* 一行文字省略号: 省略号+溢出隐藏+禁止换行 [超出宽度溢出隐藏且同省略号代替] */
		overflow: hidden;
		text-overflow: ellipsis;  /* 省略号 */
		white-space: nowrap; /* 禁止换行 */
	}
	.cate-tab2   ol li  aside p{
		font-size: 0.4rem;
		line-height: 0.6rem;
		color: #ff7100;
		font-weight: bold;
		text-align: left;
		margin-left: 0.15rem;
	}
	.cate-tab2 .xbox{
		width: 99%;
		height: 1rem;
		font-size: 0.38rem;
		margin-top: 0.3rem;
		border: 1px solid #e1e1e1;
		border-radius: 0.3rem;
		text-align: center;
		line-height: 1rem;
	}
</style>
